<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>作业9</title>
    <script>
        /*
        9. 编写函数rightchange(char,n) 实现字符串char循环右移n位。
        比如rightchange("abcdefg",2) 返回"fgabcde"
        */

        function rightChange(char, n) {
            var arr = char.split("");
            for(var i=0; i<n; i++){
                arr.unshift(arr.pop());
            }
            return arr.join("");
        }

        console.log(rightChange("abcdefg", 2));

    </script>
</head>
<body>
    
</body>
</html>